/*
 * @lc app=leetcode.cn id=1408 lang=typescript
 *
 * [1408] 数组中的字符串匹配
 */

// @lc code=start
function stringMatching(words: string[]): string[] {
    return words.filter((i) => {
        const reg = new RegExp(i);
        return words.some((word) => {
            if (word === i) {
                return false;
            }
            return reg.test(word);
        });
    });
}
// @lc code=end
